package org.blueoxygen.service.impl;

import java.util.List;
import org.blueoxygen.dao.AbsenDao;
import org.blueoxygen.entity.Absen;
import org.blueoxygen.service.AbsenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Nety Herawaty
 * 
 */

@Service
@Transactional(readOnly = true)
public class AbsenServiceImpl implements AbsenService {

	@Autowired
	private AbsenDao absenDao;

	@Transactional
	public void simpanAbsen(Absen absen) {
		absenDao.simpanAbsen(absen);
	}

	@Transactional
	public void hapusAbsen (Absen absen) {
		absenDao.remove(absen);
	}

	public Absen getAbsenById(String id) {
		return absenDao.getById(Absen.class, id);
	}

	public long getPersonCount(String namad, String namab) {
		return absenDao.getPersonCountByCriteria(namad, namab);
	}

	@Override
	public List<Absen> getAbsenList(String namad, String namab, int limit,
			int page) {

		return absenDao.getAbsenByCriteria(namad, namab, limit, page);
	}

}
